import React, { FC, memo, useState } from 'react';
import { Link } from 'umi';
import { cookie } from 'project-libs';

interface IUserInfo {
  id: number;
  username: string;
}

const Header: FC = () => {
  const [username] = useState(localStorage.getItem('username'));

  return (
    <div className="header-wrap">
      <div className="header-wrap_title">民宿</div>
      <div className="header-wrap_login">
        {username ? (
          username
        ) : (
          <>
            <Link to="/login">登录</Link> | <Link to="/register">注册</Link>
          </>
        )}
      </div>
    </div>
  );
};

export default memo(Header);
